﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;

namespace Coevery.Win.InmuebleModule.Report
{
    // Falta la valoracion del precio - Hacer motor

    public class InmuebleOverviewCollection : ArrayList, ITypedList
    {
        PropertyDescriptorCollection ITypedList.GetItemProperties(PropertyDescriptor[] listAccessors)
        {
            if (listAccessors != null && listAccessors.Length > 0)
            {
                PropertyDescriptor listAccessor = listAccessors[listAccessors.Length - 1];
                if (listAccessor.PropertyType == typeof(InmuebleIdealistaOverviewCollection))
                    return TypeDescriptor.GetProperties(typeof(InmuebleIdealistaOverview));
            }
            return TypeDescriptor.GetProperties(typeof(InmuebleOverview));
        }

        string ITypedList.GetListName(PropertyDescriptor[] listAccessors)
        {
            return "Inmuebles";
        }
    }

    public class InmuebleOverview
    {
        public Guid InmuebleId { get; set; }
        public string Barrio { get; set; }
        public string NombreVia { get; set; }
        public string Numero { get; set; }
        public string Escalera { get; set; }
        public string Planta { get; set; }
        public string Latitud { get; set; }
        public string Longitud { get; set; }
        public Guid TasacionId { get; set; }
        public Guid CarteraId { get; set; }
        public string MunicipioId { get; set; }
        public string TipoViaId { get; set; }
        public string CodigoPostal { get; set; }
        public string Puerta { get; set; }
        public string ComunidadAutonomaId { get; set; }
        public string ProvinciaId { get; set; }
        public string Metros { get; set; }
        public string TipoVivienda { get; set; }
        public string Habitaciones { get; set; }
        public string Banios { get; set; }
        public string AnioConstruccion { get; set; }
        public string AnioReforma { get; set; }
        public string Catastro { get; set; }
        public bool Amueblado { get; set; }
        public bool CocinaEquipada { get; set; }
        public bool Garaje { get; set; }
        public bool Trastero { get; set; }
        public bool Terraza { get; set; }
        public bool Jardin { get; set; }
        public bool Aire { get; set; }
        public bool Calefaccion { get; set; }
        public bool Ascensor { get; set; }
        public string Estado { get; set; }
        public double PrecioMedio { get; set; }
        public double Precio { get; set; }

        readonly InmuebleIdealistaOverviewCollection _inmuebleIdealistas = new InmuebleIdealistaOverviewCollection();

        public InmuebleIdealistaOverviewCollection InmuebleIdealistas { get { return _inmuebleIdealistas; } }



        
    }

    public class InmuebleIdealistaOverviewCollection : ArrayList, ITypedList
    {
        PropertyDescriptorCollection ITypedList.GetItemProperties(PropertyDescriptor[] listAccessors)
        {
            if (listAccessors != null && listAccessors.Length > 0)
            {
                PropertyDescriptor listAccessor = listAccessors[listAccessors.Length - 1];
                if (listAccessor.PropertyType == typeof(FotoesCollection))
                    return TypeDescriptor.GetProperties(typeof(FotoOverview));
            }
            return TypeDescriptor.GetProperties(typeof(InmuebleIdealistaOverview));
        }

        string ITypedList.GetListName(PropertyDescriptor[] listAccessors)
        {
            return "InmuebleIdealistas";
        }

        public string NombreVia { get; set; }
    }

    public class InmuebleIdealistaOverview
    {
        /* 
              InmuebleIdealistaId    AbrAddress       Address         Agency      AgentLogo       Bathrooms
              Condition              Country          Description     Distance    District        FavComment
              Favourite              Floor            HasVideo        Latitude    Longitude       Munipality
              Neighborhood           NumPhotos        Operation       PhotosUrl   Position        Price
              PropertyCode           PropertyType     PropertyTypeCodeProvince    Region          Rooms
              ShowAddress            Size             Subregion       Thumbnail   TipUsuCd        Url
              UserCode               VideoType        InmuebleId
           */

        List<FotoOverview> fotoArrayProperty;
        FotoOverview[] testFoto;

        public InmuebleIdealistaOverview()
        {
            this.fotoArrayProperty = new List<FotoOverview>();
            this.testFoto = new FotoOverview[20];
        }

        public Guid InmuebleId { get; set; }
        public Guid InmuebleIdealistaId { get; set; }
        public string AbrAddress { get; set; }
        public string Address { get; set; }
        public bool Agency { get; set; }
        public string AgentLogo { get; set; }
        public string Condition { get; set; }
        public string Bathrooms { get; set; }
        public string Country { get; set; }
        public string Description { get; set; }
        public string Distance { get; set; }
        public string District { get; set; }
        public string FavComment { get; set; }
        public bool Favourite { get; set; }
        public string Floor { get; set; }
        public bool HasVideo { get; set; }
        public string Latitude { get; set; }
        public string Longitude { get; set; }
        public string Munipality { get; set; }
        public string Neighborhood { get; set; }
        public string NumPhotos { get; set; }
        public string Operation { get; set; }
        public string PhotosUrl { get; set; }
        public string Position { get; set; }
        public string Price { get; set; }
        public string PropertyCode { get; set; }
        public string PropertyType { get; set; }
        public string PropertyTypeCode { get; set; }
        public string Province { get; set; }
        public string Region { get; set; }
        public string Rooms { get; set; }
        public bool ShowAddress { get; set; }
        public string Size { get; set; }
        public string Subregion { get; set; }
        public string Thumbnail { get; set; }
        public string TipUsuCd { get; set; }
        public string Url { get; set; }
        public string UserCode { get; set; }
        public string VideoType { get; set; }
        public double AveragePrice { get; set; }

        readonly FotoesCollection _fotoes = new FotoesCollection();

        public FotoesCollection Fotoes { get { return _fotoes; } }

        public void Add(FotoOverview note)
        {
            _fotoes.Add(note);
            //fotoListProperty.Add(note);
            testFoto[testFoto.Length-1]=note;

        }
        
        public List<FotoOverview> fotoListProperty{
            get;
            set;
        }

        public FotoOverview[] getTestFoto(){
            return this.testFoto;
        }

        public byte[] DummyFoto { get; set; }

        
    }

    public class FotoesCollection : ArrayList, ITypedList
    {
        PropertyDescriptorCollection ITypedList.GetItemProperties(PropertyDescriptor[] listAccessors)
        {
            return TypeDescriptor.GetProperties(typeof(FotoOverview));
        }

        string ITypedList.GetListName(PropertyDescriptor[] listAccessors)
        {
            return "Fotoes";
        }
    }


    public class FotoOverview
    {
        public string Description {get; set;}
        public byte[] Img { get; set; }
    }
}
